package com.raja.servingStation.datasources;


import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.sql.DataSource;

@Configuration
public class DataSourceConfig {

    @Bean(name = "dataSource")
    @ConfigurationProperties(prefix="spring.datasource.hikari")
    public DataSource dataSource() {
//        DataSourceBuilder dataSourceBuilder = new DataSourceBuilder(null);
//        HikariDataSource hikariDataSource = new HikariDataSource();
//        dataSourceBuilder.type(hikariDataSource.getClass());
        return dsp1().initializeDataSourceBuilder().build();
    }
    @Bean(name = "dsp1")
    @ConfigurationProperties(prefix = "spring.datasource")
    public DataSourceProperties dsp1(){

        return new DataSourceProperties();
    }
}
